#include "chatitem.h"

#include "ui_chatitem.h"

#include <CommonUtils.h>

ChatItem::ChatItem(QWidget* parent) : QWidget(parent),
                                      ui(new Ui::ChatItem) {
    ui->setupUi(this);
}

ChatItem::~ChatItem() {
    delete ui;
}

void ChatItem::setPixmap(QString path) {
    ui->label_head->setHeadshot(path);
}

void ChatItem::setPixmap(const QPixmap& pixmap) {
    ui->label_head->setPixmap(pixmap);
}

QPixmap ChatItem::getPixmp() {
    return *ui->label_head->pixmap();
}

void ChatItem::setName(QString name) {
    ui->label_name->setText(name);
}

void ChatItem::setMessage(QString message, QString time) {
    ui->label_message->setText(message);
    ui->label_time->setText(time);
}

QString ChatItem::getName() const {
    return ui->label_name->text();
}

QString ChatItem::getUserId() const {
    return userId;
}

void ChatItem::setUserId(QString userId) {
    this->userId = userId;
}
